#pragma once
#include "DistanceVoxel.h"
#include "mesh-struct.h"
#include<vector>

class TriangleSoupVoxel :
	public DistanceVoxel
{
public:
	TriangleSoupVoxel(void);
	//TriangleSoupVoxel(double size, int depth, double x, double y, double z);
	TriangleSoupVoxel(float size, int depth, int nodeId, TriangleSoupVoxel* parent, float x, float y, float z);
	~TriangleSoupVoxel(void);

	void				setEnclosedTriangleSoup(std::vector<float> verticesVector, std::vector<int> trianglesVector);
	int					getTriNum();	// real number of triangles (no multiplicaiton by x3)
	int					getVertNum();	// real number of vertices (no multiplication x3)
	float*				getVerts();
	int*				getTris();

	bool				isFinal();
	int					getNodeId();
	int					increaseNumChildren();
	void				setStillBorn(TriangleSoupVoxel* stillbornNode);
	TriangleSoupVoxel*	getParent();
	void				init();

	TriangleSoupVoxel**	_sibling;

private:
	int					_nodeId; // could be int from [0, 8)
	TriangleSoupVoxel*	_parent;
	MeshStruct*			_enclosedTriangleSoup;
	bool				_final;			// final - means, that the voxel does not have children (or valid children, i.e. containing geometry)
	int					_numValidChild; // number of valid children of the voxel node
	int					_numChildren;
};

